<?php

	class CMS_Controller_Action_Helper_RedirectToOrigin extends Zend_Controller_Action_Helper_Abstract
	{
		public function direct ($msg = null)
		{
			// gestion du message
			if(!is_null($msg))
			{
				Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')->addMessage($msg);
			}
			
			// get redirection
			if(!isset(Zend_Registry::get('session')->requestUri))
			{
				$gotoUrl = Zend_Registry::get('cms')->default_redirection_path;
			}
			else 
			{
				$gotoUrl = Zend_Registry::get('session')->requestUri;
			}
			
			echo $gotoUrl;
			// do redirection
			Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector')->setCode(303)->gotoUrl($gotoUrl, array("prependBase" => false));
		}
	}



?>